﻿using System;
using System.Runtime.InteropServices;

internal sealed class API
{
	[DllImport("gdi32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern bool BitBlt(IntPtr hDestDC, int X, int Y, int nWidth, int nHeight, IntPtr hSrcDC, int xSrc, int ySrc, int dwRop);

	[DllImport("gdi32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern IntPtr CreateCompatibleBitmap(IntPtr hdc, int nWidth, int nHeight);

	[DllImport("gdi32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern IntPtr CreateCompatibleDC(IntPtr hdc);

	[DllImport("gdi32", CharSet = CharSet.Unicode, EntryPoint = "CreateFontW", ExactSpelling = true, SetLastError = true)]
	public static extern IntPtr CreateFont(int nHeight, int nWidth, int nEscapement, int nOrientation, int fnWeight, int fdwItalic, int fdwUnderline, int fdwStrikeOut, int fdwCharSet, int fdwOutputPrecision, int fdwClipPrecision, int fdwQuality, int fdwPitchAndFamily, string lpszFace);

	[DllImport("gdi32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern IntPtr CreatePen(int nPenStyle, int nWidth, int crColor);

	[DllImport("gdi32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern IntPtr CreateSolidBrush(int crColor);

	[DllImport("gdi32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern bool DeleteDC(IntPtr hdc);

	[DllImport("gdi32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern bool DeleteObject(IntPtr hObject);

	[DllImport("user32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern bool DrawEdge(IntPtr hdc, ref API.RECT qrc, int Edge, int grfFlags);

	[DllImport("user32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern bool DrawFocusRect(IntPtr hdc, ref API.RECT lpRect);

	[DllImport("user32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern bool DrawIconEx(IntPtr hdc, int xLeft, int yTop, int hIcon, int cxWidth, int cyWidth, int istepIfAniCur, int hbrFlickerFreeDraw, int diFlags);

	[DllImport("user32", CharSet = CharSet.Ansi, EntryPoint = "DrawStateA", ExactSpelling = true, SetLastError = true)]
	public static extern bool DrawState(IntPtr hdc, IntPtr hBrush, int lpDrawStateProc, int lParam, int wParam, int n1, int n2, int n3, int n4, int un);

	[DllImport("user32", CharSet = CharSet.Unicode, EntryPoint = "DrawTextW", ExactSpelling = true, SetLastError = true)]
	public static extern int DrawText(IntPtr hdc, string lpStr, int nCount, ref API.RECT lpRect, int wFormat);

	[DllImport("user32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern int FillRect(IntPtr hdc, ref API.RECT lpRect, int hBrush);

	[DllImport("user32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern int GetCapture();

	[DllImport("user32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern bool GetClientRect(int hWnd, ref API.RECT lpRect);

	[DllImport("user32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern bool GetCursorPos(ref API.POINTAPI lpPoint);

	[DllImport("gdi32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern int GetDeviceCaps(IntPtr hdc, int nIndex);

	[DllImport("gdi32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern IntPtr GetStockObject(int nIndex);

	[DllImport("kernel32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern int GetVersion();

	[DllImport("user32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern int GetWindowRect(int hWnd, ref API.RECT lpRect);

	[DllImport("UxTheme.dll", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern bool IsAppThemed();

	[DllImport("gdi32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern bool LineTo(IntPtr hdc, int X, int Y);

	[DllImport("kernel32", CharSet = CharSet.Ansi, EntryPoint = "lstrlenA", ExactSpelling = true, SetLastError = true)]
	public static extern int lStrLen([MarshalAs(UnmanagedType.VBByRefStr)] ref string lpString);

	[DllImport("gdi32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern bool MoveToEx(IntPtr hdc, int X, int Y, ref API.POINTAPI lpPoint);

	[DllImport("gdi32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
    public static extern bool Rectangle(IntPtr hdc, int X1, int Y1, int X2, int Y2);

	[DllImport("user32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern bool ReleaseCapture();

	[DllImport("user32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern int ReleaseDC(IntPtr hWnd, int hdc);

	[DllImport("user32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern bool ScreenToClient(IntPtr hWnd, ref API.POINTAPI lpPoint);

	[DllImport("gdi32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern IntPtr SelectObject(IntPtr hdc, IntPtr hObject);

	[DllImport("user32", CharSet = CharSet.Ansi, EntryPoint = "SendMessageA", ExactSpelling = true, SetLastError = true)]
	public static extern int SendMessage(int hWnd, int wMsg, int wParam, ref int lParam);

	[DllImport("gdi32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern int SetBkMode(IntPtr hdc, int nBkMode);

	[DllImport("user32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern int SetCapture(int hWnd);

	[DllImport("user32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern int SetParent(int hWndChild, int hWndNewParent);

	[DllImport("gdi32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern int SetPixelV(int hdc, int x, int y, int crColor);

	[DllImport("user32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern int SetRect(ref API.RECT lpRect, int X1, int Y1, int X2, int Y2);

	[DllImport("gdi32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern int SetStretchBltMode(IntPtr hdc, int nStretchMode);

	[DllImport("user32", CharSet = CharSet.Ansi, EntryPoint = "SetWindowLongA", ExactSpelling = true, SetLastError = true)]
	public static extern int SetWindowLong(int hWnd, int nIndex, int dwNewLong);

	[DllImport("shell32.dll", CharSet = CharSet.Ansi, EntryPoint = "ShellExecuteA", ExactSpelling = true, SetLastError = true)]
	public static extern bool ShellExecute(int hWnd, [MarshalAs(UnmanagedType.VBByRefStr)] ref string lpOperation, [MarshalAs(UnmanagedType.VBByRefStr)] ref string lpFile, [MarshalAs(UnmanagedType.VBByRefStr)] ref string lpParameters, [MarshalAs(UnmanagedType.VBByRefStr)] ref string lpDirectory, int nShowCmd);

	[DllImport("gdi32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
	public static extern bool StretchBlt(IntPtr hdc, int X, int Y, int nWidth, int nHeight, IntPtr hSrcDC, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, int dwRop);

	public const short ANSI_CHARSET = 0;

	public const short BDR_INNER = 12;

	public const short BDR_OUTER = 3;

	public const short BDR_RAISED = 5;

	public const short BDR_RAISEDINNER = 4;

	public const short BDR_RAISEDOUTER = 1;

	public const short BDR_SUNKEN = 10;

	public const short BDR_SUNKENINNER = 8;

	public const short BDR_SUNKENOUTER = 2;

	public const short BF_BOTTOM = 8;

	public const short BF_LEFT = 1;

	public const short BF_RECT = 15;

	public const short BF_RIGHT = 4;

	public const short BF_TOP = 2;

	public const short CLIP_DEFAULT_PRECIS = 0;

	public const short DEFAULT_CHARSET = 1;

	public const short DEFAULT_PITCH = 0;

	public const short DEFAULT_QUALITY = 0;

	public const short DI_NORMAL = 3;

	public const short DT_BOTTOM = 8;

	public const short DT_CALCRECT = 1024;

	public const short DT_CENTER = 1;

	public const short DT_EDITCONTROL = 8192;

	public const int DT_END_ELLIPSIS = 32768;

	public const short DT_LEFT = 0;

	public const int DT_MODIFYSTRING = 65536;

	public const short DT_NOPREFIX = 2048;

	public const short DT_RIGHT = 2;

	public const short DT_SINGLELINE = 32;

	public const short DT_TOP = 0;

	public const short DT_VCENTER = 4;

	public const int DT_WORD_ELLIPSIS = 262144;

	public const short DT_WORDBREAK = 16;

	public const short FF_MODERN = 48;

	public const short FW_BOLD = 700;

	public const short FW_NORMAL = 400;

	public const short GB2312_CHARSET = 134;

	public const short GWL_EXSTYLE = -20;

	public const short GWL_STYLE = -16;

	public const short LB_GETITEMHEIGHT = 417;

	public const short LOGPIXELSX = 88;

	public const short LOGPIXELSY = 90;

	public const short NULL_BRUSH = 5;

	public const short OEM_CHARSET = 255;

	public const short OUT_DEFAULT_PRECIS = 0;

	public const int SRCAND = 8913094;

	public const int SRCCOPY = 13369376;

	public const short WS_EX_TOOLWINDOW = 128;

	public const short WS_EX_TOPMOST = 8;

	public struct POINTAPI
	{
		public int X;

		public int Y;
	}

	public struct RECT
	{
		public int Left;

		public int Top;

		public int Right;

		public int Bottom;
	}
}
